home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / lib / mozilla-firefox / include / xpcom / xpt_struct.h < prev    next >
C/C++ Source or Header  |  2006-05-08  |  20KB  |  538 lines

  1. /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
  2. /* ***** BEGIN LICENSE BLOCK *****
  3.  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  4.  *
  5.  * The contents of this file are subject to the Mozilla Public License Version
  6.  * 1.1 (the "License"); you may not use this file except in compliance with
  7.  * the License. You may obtain a copy of the License at
  8.  * http://www.mozilla.org/MPL/
  9.  *
  10.  * Software distributed under the License is distributed on an "AS IS" basis,
  11.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  12.  * for the specific language governing rights and limitations under the
  13.  * License.
  14.  *
  15.  * The Original Code is mozilla.org code.
  16.  *
  17.  * The Initial Developer of the Original Code is
  18.  * Netscape Communications Corporation.
  19.  * Portions created by the Initial Developer are Copyright (C) 1998
  20.  * the Initial Developer. All Rights Reserved.
  21.  *
  22.  * Contributor(s):
  23.  *
  24.  * Alternatively, the contents of this file may be used under the terms of
  25.  * either of the GNU General Public License Version 2 or later (the "GPL"),
  26.  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  27.  * in which case the provisions of the GPL or the LGPL are applicable instead
  28.  * of those above. If you wish to allow use of your version of this file only
  29.  * under the terms of either the GPL or the LGPL, and not to allow others to
  30.  * use your version of this file under the terms of the MPL, indicate your
  31.  * decision by deleting the provisions above and replace them with the notice
  32.  * and other provisions required by the GPL or the LGPL. If you do not delete
  33.  * the provisions above, a recipient may use your version of this file under
  34.  * the terms of any one of the MPL, the GPL or the LGPL.
  35.  *
  36.  * ***** END LICENSE BLOCK ***** */
  37.  
  38. /*
  39.  * Structures matching the in-memory representation of typelib structures.
  40.  * http://www.mozilla.org/scriptable/typelib_file.html
  41.  */
  42.  
  43. #ifndef __xpt_struct_h__
  44. #define __xpt_struct_h__
  45.  
  46. #include "xpt_arena.h"
  47.  
  48. PR_BEGIN_EXTERN_C
  49.  
  50. /*
  51.  * Originally, I was going to have structures that exactly matched the on-disk
  52.  * representation, but that proved difficult: different compilers can pack
  53.  * their structs differently, and that makes overlaying them atop a
  54.  * read-from-disk byte buffer troublesome.  So now I just have some structures
  55.  * that are used in memory, and we're going to write a nice XDR library to
  56.  * write them to disk and stuff.  It is pure joy. -- shaver
  57.  */
  58.  
  59. /* Structures for the typelib components */
  60.  
  61. typedef struct XPTHeader XPTHeader;
  62. typedef struct XPTInterfaceDirectoryEntry XPTInterfaceDirectoryEntry;
  63. typedef struct XPTInterfaceDescriptor XPTInterfaceDescriptor;
  64. typedef struct XPTConstDescriptor XPTConstDescriptor;
  65. typedef struct XPTMethodDescriptor XPTMethodDescriptor;
  66. typedef struct XPTParamDescriptor XPTParamDescriptor;
  67. typedef struct XPTTypeDescriptor XPTTypeDescriptor;
  68. typedef struct XPTTypeDescriptorPrefix XPTTypeDescriptorPrefix;
  69. typedef struct XPTString XPTString;
  70. typedef struct XPTAnnotation XPTAnnotation;
  71. #ifndef nsID_h__
  72. /*
  73.  * We can't include nsID.h, because it's full of C++ goop and we're not doing
  74.  * C++ here, so we define our own minimal struct.  We protect against multiple
  75.  * definitions of this struct, though, and use the same field naming.
  76.  */
  77. struct nsID {
  78.     PRUint32 m0;
  79.     PRUint16 m1;
  80.     PRUint16 m2;
  81.     PRUint8  m3[8];
  82. };
  83.  
  84. typedef struct nsID nsID;
  85. #endif
  86.  
  87. #define XPT_COPY_IID(to, from)                                                \
  88.   (to).m0 = (from).m0;                                                        \
  89.   (to).m1 = (from).m1;                                                        \
  90.   (to).m2 = (from).m2;                                                        \
  91.   (to).m3[0] = (from).m3[0];                                                  \
  92.   (to).m3[1] = (from).m3[1];                                                  \
  93.   (to).m3[2] = (from).m3[2];                                                  \
  94.   (to).m3[3] = (from).m3[3];                                                  \
  95.   (to).m3[4] = (from).m3[4];                                                  \
  96.   (to).m3[5] = (from).m3[5];                                                  \
  97.   (to).m3[6] = (from).m3[6];                                                  \
  98.   (to).m3[7] = (from).m3[7];
  99.  
  100.  
  101. /*
  102.  * Every XPCOM typelib file begins with a header.
  103.  */
  104. struct XPTHeader {
  105.     PRUint8                     magic[16];
  106.     PRUint8                     major_version;
  107.     PRUint8                     minor_version;
  108.     PRUint16                    num_interfaces;
  109.     PRUint32                    file_length;
  110.     XPTInterfaceDirectoryEntry  *interface_directory;
  111.     PRUint32                    data_pool;
  112.     XPTAnnotation               *annotations;
  113. };
  114.  
  115. #define XPT_MAGIC "XPCOM\nTypeLib\r\n\032"
  116. /* For error messages. */
  117. #define XPT_MAGIC_STRING "XPCOM\\nTypeLib\\r\\n\\032"
  118. #define XPT_MAJOR_VERSION 0x01
  119. #define XPT_MINOR_VERSION 0x02
  120.  
  121. /* Any file with a major version number of XPT_MAJOR_INCOMPATIBLE_VERSION 
  122.  * or higher is to be considered incompatible by this version of xpt and
  123.  * we will refuse to read it. We will return a header with magic, major and
  124.  * minor versions set from the file. num_interfaces and file_length will be
  125.  * set to zero to confirm our inability to read the file; i.e. even if some
  126.  * client of this library gets out of sync with us regarding the agreed upon
  127.  * value for XPT_MAJOR_INCOMPATIBLE_VERSION, anytime num_interfaces and
  128.  * file_length are both zero we *know* that this library refused to read the 
  129.  * file due to version imcompatibility.  
  130.  */
  131. #define XPT_MAJOR_INCOMPATIBLE_VERSION 0x02
  132.  
  133. /*
  134.  * The "[-t version number]" cmd line parameter to the XPIDL compiler and XPT
  135.  * linker specifies the major and minor version number of the output 
  136.  * type library.
  137.  * 
  138.  * The goal is for the compiler to check that the input IDL file only uses 
  139.  * constructs that are supported in the version specified. The linker will
  140.  * check that all typelib files it reads are of the version specified or
  141.  * below.
  142.  * 
  143.  * Both the compiler and the linker will report errors and abort if these
  144.  * checks fail.
  145.  * 
  146.  * When you rev up major or minor versions of the type library in the future,
  147.  * think about the new stuff that you added to the type library and add checks
  148.  * to make sure that occurrences of that new "stuff" will get caught when [-t
  149.  * version number] is used with the compiler. Here's what you'll probably
  150.  * have to do each time you rev up major/minor versions:
  151.  * 
  152.  *   1) Add the current version number string (before your change) to the
  153.  *   XPT_TYPELIB_VERSIONS list.
  154.  * 
  155.  *   2) Do your changes add new features to XPIDL? Ensure that those new
  156.  *   features are rejected by the XPIDL compiler when any version number in
  157.  *   the XPT_TYPELIB_VERSIONS list is specified on the command line. The
  158.  *   one place that currently does this kind of error checking is the function
  159.  *   verify_type_fits_version() in xpidl_util.c. It currently checks
  160.  *   attribute types, parameter types, and return types. You'll probably have
  161.  *   to add to it or generalize it further based on what kind of changes you
  162.  *   are making.
  163.  *
  164.  *   3) You will probably NOT need to make any changes to the error checking
  165.  *   in the linker.
  166.  */
  167.   
  168. #define XPT_VERSION_UNKNOWN     0
  169. #define XPT_VERSION_UNSUPPORTED 1
  170. #define XPT_VERSION_OLD         2
  171. #define XPT_VERSION_CURRENT     3
  172.  
  173. typedef struct {
  174.     const char* str;
  175.     PRUint8     major;
  176.     PRUint8     minor;
  177.     PRUint16    code;
  178. } XPT_TYPELIB_VERSIONS_STRUCT; 
  179.  
  180. /* Currently accepted list of versions for typelibs */
  181. #define XPT_TYPELIB_VERSIONS {                                                \
  182.     {"1.0", 1, 0, XPT_VERSION_UNSUPPORTED},                                   \
  183.     {"1.1", 1, 1, XPT_VERSION_OLD},                                           \
  184.     {"1.2", 1, 2, XPT_VERSION_CURRENT}                                        \
  185. }
  186.  
  187. extern XPT_PUBLIC_API(PRUint16)
  188. XPT_ParseVersionString(const char* str, PRUint8* major, PRUint8* minor);
  189.  
  190. extern XPT_PUBLIC_API(XPTHeader *)
  191. XPT_NewHeader(XPTArena *arena, PRUint16 num_interfaces, 
  192.               PRUint8 major_version, PRUint8 minor_version);
  193.  
  194. extern XPT_PUBLIC_API(void)
  195. XPT_FreeHeader(XPTArena *arena, XPTHeader* aHeader);
  196.  
  197. /* size of header and annotations */
  198. extern XPT_PUBLIC_API(PRUint32)
  199. XPT_SizeOfHeader(XPTHeader *header);
  200.  
  201. /* size of header and annotations and InterfaceDirectoryEntries */
  202. extern XPT_PUBLIC_API(PRUint32)
  203. XPT_SizeOfHeaderBlock(XPTHeader *header);
  204.  
  205. /*
  206.  * A contiguous array of fixed-size InterfaceDirectoryEntry records begins at 
  207.  * the byte offset identified by the interface_directory field in the file 
  208.  * header.  The array is used to quickly locate an interface description 
  209.  * using its IID.  No interface should appear more than once in the array.
  210.  */
  211. struct XPTInterfaceDirectoryEntry {
  212.     nsID                   iid;
  213.     char                   *name;
  214.     char                   *name_space;
  215.     XPTInterfaceDescriptor *interface_descriptor;
  216.  
  217. #if 0 /* not yet */
  218.     /* not stored on disk */
  219.     PRUint32                 offset; /* the offset for an ID still to be read */
  220. #endif
  221. };
  222.  
  223. extern XPT_PUBLIC_API(PRBool)
  224. XPT_FillInterfaceDirectoryEntry(XPTArena *arena, 
  225.                                 XPTInterfaceDirectoryEntry *ide,
  226.                                 nsID *iid, char *name, char *name_space,
  227.                                 XPTInterfaceDescriptor *descriptor);
  228.  
  229. extern XPT_PUBLIC_API(void)
  230. XPT_DestroyInterfaceDirectoryEntry(XPTArena *arena, 
  231.                                    XPTInterfaceDirectoryEntry* ide);
  232.  
  233. /*
  234.  * An InterfaceDescriptor is a variable-size record used to describe a 
  235.  * single XPCOM interface, including all of its methods. 
  236.  */
  237. struct XPTInterfaceDescriptor {
  238.     PRUint16                parent_interface;
  239.     PRUint16                num_methods;
  240.     XPTMethodDescriptor     *method_descriptors;
  241.     PRUint16                num_constants;
  242.     XPTConstDescriptor      *const_descriptors;
  243.     PRUint8                 flags;
  244.  
  245.     /* additional_types are used for arrays where we may need multiple
  246.     *  XPTTypeDescriptors for a single XPTMethodDescriptor. Since we still
  247.     *  want to have a simple array of XPTMethodDescriptor (each with a single
  248.     *  embedded XPTTypeDescriptor), a XPTTypeDescriptor can have a reference
  249.     *  to an 'additional_type'. That reference is an index in this 
  250.     *  "additional_types" array. So a given XPTMethodDescriptor might have 
  251.     *  a whole chain of these XPTTypeDescriptors to represent, say, a multi
  252.     *  dimensional array.
  253.     *
  254.     *  Note that in the typelib file these additional types are stored 'inline'
  255.     *  in the MethodDescriptor. But, in the typelib MethodDescriptors can be 
  256.     *  of varying sizes, where in XPT's in memory mapping of the data we want 
  257.     *  them to be of fixed size. This additional_types scheme is here to allow 
  258.     *  for that.
  259.     */
  260.  
  261.     XPTTypeDescriptor       *additional_types;
  262.     PRUint16                num_additional_types;
  263. };
  264.  
  265. #define XPT_ID_SCRIPTABLE           0x80
  266. #define XPT_ID_FUNCTION             0x40
  267. #define XPT_ID_FLAGMASK             0xc0
  268. #define XPT_ID_TAGMASK              (~XPT_ID_FLAGMASK)
  269. #define XPT_ID_TAG(id)              ((id).flags & XPT_ID_TAGMASK)
  270.  
  271. #define XPT_ID_IS_SCRIPTABLE(flags) (flags & XPT_ID_SCRIPTABLE)
  272. #define XPT_ID_IS_FUNCTION(flags) (flags & XPT_ID_FUNCTION)
  273.  
  274. extern XPT_PUBLIC_API(PRBool)
  275. XPT_GetInterfaceIndexByName(XPTInterfaceDirectoryEntry *ide_block,
  276.                             PRUint16 num_interfaces, char *name, 
  277.                             PRUint16 *indexp);
  278.  
  279. extern XPT_PUBLIC_API(XPTInterfaceDescriptor *)
  280. XPT_NewInterfaceDescriptor(XPTArena *arena, 
  281.                            PRUint16 parent_interface, PRUint16 num_methods,
  282.                            PRUint16 num_constants, PRUint8 flags);
  283.  
  284. extern XPT_PUBLIC_API(void)
  285. XPT_FreeInterfaceDescriptor(XPTArena *arena, XPTInterfaceDescriptor* id);
  286.  
  287. extern XPT_PUBLIC_API(PRBool)
  288. XPT_InterfaceDescriptorAddTypes(XPTArena *arena, XPTInterfaceDescriptor *id, 
  289.                                 PRUint16 num);
  290.  
  291. extern XPT_PUBLIC_API(PRBool)
  292. XPT_InterfaceDescriptorAddMethods(XPTArena *arena, XPTInterfaceDescriptor *id, 
  293.                                   PRUint16 num);
  294.  
  295. extern XPT_PUBLIC_API(PRBool)
  296. XPT_InterfaceDescriptorAddConsts(XPTArena *arena, XPTInterfaceDescriptor *id, 
  297.                                  PRUint16 num);
  298.  
  299. /*
  300.  * This is our special string struct with a length value associated with it,
  301.  * which means that it can contains embedded NULs.
  302.  */
  303. struct XPTString {
  304.     PRUint16 length;
  305.     char   *bytes;
  306. };
  307.  
  308. extern XPT_PUBLIC_API(XPTString *)
  309. XPT_NewString(XPTArena *arena, PRUint16 length, char *bytes);
  310.  
  311. extern XPT_PUBLIC_API(XPTString *)
  312. XPT_NewStringZ(XPTArena *arena, char *bytes);
  313.  
  314. /* 
  315.  * A TypeDescriptor is a variable-size record used to identify the type of a 
  316.  * method argument or return value. 
  317.  *
  318.  * There are three types of TypeDescriptors:
  319.  *
  320.  * SimpleTypeDescriptor
  321.  * InterfaceTypeDescriptor
  322.  * InterfaceIsTypeDescriptor
  323.  *
  324.  * The tag field in the prefix indicates which of the variant TypeDescriptor 
  325.  * records is being used, and hence the way any remaining fields should be 
  326.  * parsed. Values from 0 to 17 refer to SimpleTypeDescriptors. The value 18 
  327.  * designates an InterfaceTypeDescriptor, while 19 represents an 
  328.  * InterfaceIsTypeDescriptor.
  329.  */
  330.  
  331. /* why bother with a struct?  - other code relies on this being a struct */
  332. struct XPTTypeDescriptorPrefix {
  333.     PRUint8 flags;
  334. };
  335.  
  336. /* flag bits -- fur and jband were right, I was miserably wrong */
  337. #define XPT_TDP_POINTER          0x80
  338. #define XPT_TDP_UNIQUE_POINTER   0x40
  339. #define XPT_TDP_REFERENCE        0x20
  340. #define XPT_TDP_FLAGMASK         0xe0
  341. #define XPT_TDP_TAGMASK          (~XPT_TDP_FLAGMASK)
  342. #define XPT_TDP_TAG(tdp)         ((tdp).flags & XPT_TDP_TAGMASK)
  343.  
  344. #define XPT_TDP_IS_POINTER(flags)        (flags & XPT_TDP_POINTER)
  345. #define XPT_TDP_IS_UNIQUE_POINTER(flags) (flags & XPT_TDP_UNIQUE_POINTER)
  346. #define XPT_TDP_IS_REFERENCE(flags)      (flags & XPT_TDP_REFERENCE)
  347.  
  348. /* 
  349.  * The following enum maps mnemonic names to the different numeric values 
  350.  * of XPTTypeDescriptor->tag.
  351.  */
  352. enum XPTTypeDescriptorTags {
  353.     TD_INT8              = 0,
  354.     TD_INT16             = 1,
  355.     TD_INT32             = 2,
  356.     TD_INT64             = 3,
  357.     TD_UINT8             = 4,
  358.     TD_UINT16            = 5,
  359.     TD_UINT32            = 6,
  360.     TD_UINT64            = 7,
  361.     TD_FLOAT             = 8, 
  362.     TD_DOUBLE            = 9,
  363.     TD_BOOL              = 10,  
  364.     TD_CHAR              = 11,  
  365.     TD_WCHAR             = 12, 
  366.     TD_VOID              = 13,  
  367.     TD_PNSIID            = 14,
  368.     TD_DOMSTRING         = 15,
  369.     TD_PSTRING           = 16,
  370.     TD_PWSTRING          = 17,
  371.     TD_INTERFACE_TYPE    = 18,
  372.     TD_INTERFACE_IS_TYPE = 19,
  373.     TD_ARRAY             = 20,
  374.     TD_PSTRING_SIZE_IS   = 21,
  375.     TD_PWSTRING_SIZE_IS  = 22,
  376.     TD_UTF8STRING        = 23,
  377.     TD_CSTRING           = 24,
  378.     TD_ASTRING           = 25
  379. };
  380.  
  381. struct XPTTypeDescriptor {
  382.     XPTTypeDescriptorPrefix prefix;
  383.     PRUint8 argnum;                 /* used for iid_is and size_is */
  384.     PRUint8 argnum2;                /* used for length_is */
  385.     union {                         
  386.         PRUint16 iface;             /* used for TD_INTERFACE_TYPE */
  387.         PRUint16 additional_type;   /* used for TD_ARRAY */
  388.     } type;
  389. };
  390.  
  391. #define XPT_COPY_TYPE(to, from)                                               \
  392.   (to).prefix.flags = (from).prefix.flags;                                    \
  393.   (to).argnum = (from).argnum;                                                \
  394.   (to).argnum2 = (from).argnum2;                                              \
  395.   (to).type.additional_type = (from).type.additional_type;
  396.  
  397. /*
  398.  * A ConstDescriptor is a variable-size record that records the name and 
  399.  * value of a scoped interface constant. 
  400.  *
  401.  * The types of the method parameter are restricted to the following subset 
  402.  * of TypeDescriptors: 
  403.  *
  404.  * int8, uint8, int16, uint16, int32, uint32, 
  405.  * int64, uint64, wchar_t, char, string
  406.  * 
  407.  * The type (and thus the size) of the value record is determined by the 
  408.  * contents of the associated TypeDescriptor record. For instance, if type 
  409.  * corresponds to int16, then value is a two-byte record consisting of a 
  410.  * 16-bit signed integer.  For a ConstDescriptor type of string, the value 
  411.  * record is of type String*, i.e. an offset within the data pool to a 
  412.  * String record containing the constant string.
  413.  */
  414. union XPTConstValue {
  415.     PRInt8    i8;
  416.     PRUint8   ui8; 
  417.     PRInt16   i16; 
  418.     PRUint16  ui16;
  419.     PRInt32   i32; 
  420.     PRUint32  ui32;
  421.     PRInt64   i64; 
  422.     PRUint64  ui64; 
  423.     float     flt;
  424.     double    dbl;
  425.     PRBool    bul;
  426.     char      ch; 
  427.     PRUint16  wch;
  428.     nsID      *iid;
  429.     XPTString *string;
  430.     char      *str;
  431.     PRUint16  *wstr;
  432. }; /* varies according to type */
  433.  
  434. struct XPTConstDescriptor {
  435.     char                *name;
  436.     XPTTypeDescriptor   type;
  437.     union XPTConstValue value;
  438. };
  439.  
  440. /*
  441.  * A ParamDescriptor is a variable-size record used to describe either a 
  442.  * single argument to a method or a method's result.
  443.  */
  444. struct XPTParamDescriptor {
  445.     PRUint8           flags;
  446.     XPTTypeDescriptor type;
  447. };
  448.  
  449. /* flag bits -- jband and fur were right, and I was miserably wrong */
  450. #define XPT_PD_IN       0x80
  451. #define XPT_PD_OUT      0x40
  452. #define XPT_PD_RETVAL   0x20
  453. #define XPT_PD_SHARED   0x10
  454. #define XPT_PD_DIPPER   0x08
  455. #define XPT_PD_FLAGMASK 0xf8
  456.  
  457. #define XPT_PD_IS_IN(flags)     (flags & XPT_PD_IN)
  458. #define XPT_PD_IS_OUT(flags)    (flags & XPT_PD_OUT)
  459. #define XPT_PD_IS_RETVAL(flags) (flags & XPT_PD_RETVAL)
  460. #define XPT_PD_IS_SHARED(flags) (flags & XPT_PD_SHARED)
  461. #define XPT_PD_IS_DIPPER(flags) (flags & XPT_PD_DIPPER)
  462.  
  463. extern XPT_PUBLIC_API(PRBool)
  464. XPT_FillParamDescriptor(XPTArena *arena, 
  465.                         XPTParamDescriptor *pd, PRUint8 flags,
  466.                         XPTTypeDescriptor *type);
  467.  
  468. /*
  469.  * A MethodDescriptor is a variable-size record used to describe a single 
  470.  * interface method.
  471.  */
  472. struct XPTMethodDescriptor {
  473.     char                *name;
  474.     XPTParamDescriptor  *params;
  475.     XPTParamDescriptor  *result;
  476.     PRUint8             flags;
  477.     PRUint8             num_args;
  478. };
  479.  
  480. /* flag bits -- jband and fur were right, and I was miserably wrong */
  481. #define XPT_MD_GETTER   0x80
  482. #define XPT_MD_SETTER   0x40
  483. #define XPT_MD_NOTXPCOM 0x20
  484. #define XPT_MD_CTOR     0x10
  485. #define XPT_MD_HIDDEN   0x08
  486. #define XPT_MD_FLAGMASK 0xf8
  487.  
  488. #define XPT_MD_IS_GETTER(flags)     (flags & XPT_MD_GETTER)
  489. #define XPT_MD_IS_SETTER(flags)     (flags & XPT_MD_SETTER)
  490. #define XPT_MD_IS_NOTXPCOM(flags)   (flags & XPT_MD_NOTXPCOM)
  491. #define XPT_MD_IS_CTOR(flags)       (flags & XPT_MD_CTOR)
  492. #define XPT_MD_IS_HIDDEN(flags)     (flags & XPT_MD_HIDDEN)
  493.  
  494. extern XPT_PUBLIC_API(PRBool)
  495. XPT_FillMethodDescriptor(XPTArena *arena, 
  496.                          XPTMethodDescriptor *meth, PRUint8 flags, char *name,
  497.                          PRUint8 num_args);
  498.  
  499. /*
  500.  * Annotation records are variable-size records used to store secondary 
  501.  * information about the typelib, e.g. such as the name of the tool that 
  502.  * generated the typelib file, the date it was generated, etc.  The 
  503.  * information is stored with very loose format requirements so as to 
  504.  * allow virtually any private data to be stored in the typelib.
  505.  *
  506.  * There are two types of Annotations:
  507.  *
  508.  * EmptyAnnotation
  509.  * PrivateAnnotation
  510.  *
  511.  * The tag field of the prefix discriminates among the variant record 
  512.  * types for Annotation's.  If the tag is 0, this record is an 
  513.  * EmptyAnnotation. EmptyAnnotation's are ignored - they're only used to 
  514.  * indicate an array of Annotation's that's completely empty.  If the tag 
  515.  * is 1, the record is a PrivateAnnotation. 
  516.  */
  517.  
  518. struct XPTAnnotation {
  519.     XPTAnnotation *next;
  520.     PRUint8       flags;
  521.     /* remaining fields are present in typelib iff XPT_ANN_IS_PRIVATE */
  522.     XPTString     *creator;
  523.     XPTString     *private_data;
  524. };
  525.  
  526. #define XPT_ANN_LAST                    0x80
  527. #define XPT_ANN_IS_LAST(flags)          (flags & XPT_ANN_LAST)
  528. #define XPT_ANN_PRIVATE                 0x40
  529. #define XPT_ANN_IS_PRIVATE(flags)       (flags & XPT_ANN_PRIVATE)
  530.  
  531. extern XPT_PUBLIC_API(XPTAnnotation *)
  532. XPT_NewAnnotation(XPTArena *arena, PRUint8 flags, XPTString *creator, 
  533.                   XPTString *private_data);
  534.  
  535. PR_END_EXTERN_C
  536.  
  537. #endif /* __xpt_struct_h__ */
  538.